import 'package:flutter/material.dart';
import 'package:flutter_getx/app/base/load_image.dart';
import 'package:flutter_getx/res/dimens/dimens.dart';
import 'package:flutter_getx/res/gaps.dart';

class InputTextField extends StatelessWidget {
  const InputTextField({Key? key, this.labelText, this.prefixText, required this.iconPath, required this.textField})
      : super(key: key);

  final Widget? labelText;
  final Widget? prefixText;
  final Widget textField;
  final String iconPath;

  @override
  Widget build(BuildContext context) {
    return ConstrainedBox(
      constraints: BoxConstraints(
        minHeight: Dp.dp_65,
      ),
      child: Stack(
        children: [
          Row(
            children: [
              SizedBox(width: Dp.dp_5,),
              LoadImage(
                iconPath,
                width: Dp.dp_23,
                height: Dp.dp_23,
                fit: BoxFit.cover,
              ),
              SizedBox(width: Dp.dp_17,),
              ConstrainedBox(
                constraints: BoxConstraints(
                  minHeight: Dp.dp_52,
                ),
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    labelText ?? Gaps.empty,
                    SizedBox(height: Dp.dp_12,),
                    prefixText ?? Gaps.empty,
                  ],
                ),
              )
            ],
          ),
          Column(
            children: [
              SizedBox(height: Dp.dp_13,),
              textField
            ],
          )
        ],
      ),
    );
  }
}
